package com.example.controller;

import com.example.dao.StudentDao;
import com.example.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
public class TestThymelefa {
    @Resource
    StudentDao studentDao;
    @RequestMapping("test")
    public String test(Model model){
        //*可以指定对象代替上下文对象，获取父类标签的值
        model.addAttribute("lastName","Jerry");
        Student student=new Student();
        model.addAttribute("student",student);
        student.setStuname("你好");
        model.addAttribute("msg","测试方法调用成功");
        model.addAttribute("list",studentDao.select());
        return "success";
    }
}
